﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data.Objects.DataClasses;

namespace Mss.Data.Repositories
{
    public interface IRepository<T> where T : EntityObject
    {
        /// <summary>
        /// Entities chached from last load.
        /// </summary>
        ReadOnlyObservableCollection<T> CachedObjects { get; }

        /// <summary>
        /// Refresh objects from database.
        /// </summary>
        void RefreshCache();

        /// <summary>
        /// Load objects from database.
        /// </summary>
        void Load();

        /// <summary>
        /// Saves changes to database.
        /// </summary>
        void SaveChanges();

        /// <summary>
        /// Add object to current objects set.
        /// </summary>
        void AddObject(T obj);
    }
}